package com.dao.impl;

import com.dao.ChartDao;
import com.dao.ChartRedisDao;
import com.dao.RefreshChartDao;
import com.entity.Chart;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.sql.SQLException;
import java.util.List;

@Component
public class RefreshChartDaoImpl implements  RefreshChartDao{
    @Resource
    ChartDao chartDao;
    @Resource
    ChartRedisDao chartRedisDao;

    public void refreshGetCountMemberChartByMbcost() throws SQLException, ClassNotFoundException {
     List<Chart> charts = chartDao.getCountMemberChartByMbcost();//从mysql中拿出排行榜的数据
        chartRedisDao.pushCharts(charts,"memberTop3byMcost");//将数据存入redis
    }
}
